package com.tm.chargecar.service.impl;

import com.tm.chargecar.entity.OrderDetailEntity;
import com.tm.chargecar.mapper.OrderDetailMapper;
import com.tm.chargecar.result.Result;
import com.tm.chargecar.service.OrderDetailService;
import com.tm.chargecar.utils.PageUtil;
import com.tm.chargecar.vo.OrderDetailVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.sql.SQLOutput;
import java.util.List;
import java.util.Random;

import java.util.List;


/**
 * @author 该死了
 * @create 2022-08-25 19:21
 * 两轮车账单
 */
@Service
public class OrderDetailServiceImpl implements OrderDetailService {
   @Autowired
   private OrderDetailMapper orderDetailMapper;
   //两轮车条件查询
    @Override

    public Result query(OrderDetailVo orderDetailVo) {
        //查询总条数
        Long total=orderDetailMapper.total(orderDetailVo);
        PageUtil pageUtil=new PageUtil();
        pageUtil.setTotalCount(total);
       //条件查询两轮车信息
        List<OrderDetailEntity> list=orderDetailMapper.query(orderDetailVo);
        pageUtil.setData(list);
        return Result.SUCCESS(pageUtil);
    }

    @Override
    public Result add(OrderDetailEntity orderDetailEntity) {
<<<<<<< HEAD
        int num =(int) (Math.random( )*1000000);
        Long nm= Long.valueOf(num);
        Long l = System.currentTimeMillis();
        orderDetailEntity.setOrderNumber(nm+l);
        orderDetailMapper.add(orderDetailEntity);
        return Result.SUCCESS();
    }


=======
        return null;
    }
>>>>>>> origin/dev
}
